FROM ubuntu:16.04
MAINTAINER Li Jian
ENV REFRESHED_AT 2017-12-28

ADD sources.list /etc/apt/sources.list
RUN apt -y update && \
    apt -y install iputils-ping net-tools curl wget telnet && \
    apt -y install ruby-dev git libcurl4-openssl-dev build-essential python
RUN gem install --no-ri --no-rdoc uwsgi sinatra
RUN uwsgi --build-plugin https://github.com/unbit/uwsgi-consul
RUN mkdir -p /opt/distributed_app

# uwsgi从当前目录查找 consul_plugin.so，而不是从/查找
RUN mv /consul_plugin.so /opt/distributed_app/

WORKDIR /opt/distributed_app

ADD uwsgi-consul.ini /opt/distributed_app/
ADD config.ru /opt/distributed_app/

ENTRYPOINT ["uwsgi", "--ini", "uwsgi-consul.ini", "--ini", "uwsgi-consul.ini:server1", "--ini", "uwsgi-consul.ini:server2"]

